package com.ctsi.uaa.enums;

import com.ctsi.core.common.annotation.ExceptionEnum;
import com.ctsi.core.common.constant.MarsExceptionConstant;
import com.ctsi.core.common.enums.BaseExceptionEnum;
import com.ctsi.core.common.factory.ExceptionEnumFactory;
import lombok.AllArgsConstructor;


/**
 * @version 1.0
 * @author: wang xiao xiang
 * @date: 2021/8/10 10:53
 */
@AllArgsConstructor
@ExceptionEnum(module = MarsExceptionConstant.MARS_UAA_MODULE, kind = MarsExceptionConstant.MARS_UAA_ENUM)
public enum UaaExceptionEnum implements BaseExceptionEnum {
    /**
     * 异常类型
     */
    PASSWORD_INVALID(1, "您输入的密码不正确"),
    PARAMS_NOT_EXIST(2, "请求参数为空"),
    VERIFICATION_CODE_IS_EMPTY(3, "请输入验证码"),
    VERIFICATION_CODE_EXPIRED(4, "验证码已过期"),
    VERIFICATION_CODE_ERROR(5, "验证码不正确"),
    USER_NOT_EXIST(6, "您输入的用户不存在"),
    USER_DISABLE(7, "您的账户已停用"),
    USER_ROLE_NOT_EXIST(8, "您的账户角色权限未配置"),
    FEIGN_REQUEST_ERROR(9, "请求发送失败"),
    ;

    private final Integer code;

    private final String message;

    @Override
    public Integer getCode() {
        return ExceptionEnumFactory.getExceptionEnum(this.getClass(), code);
    }

    @Override
    public String getMessage() {
        return message;
    }
}